import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from "node:path"
const resolve = (p: string) => path.resolve(process.cwd(), p)
export default defineConfig({
  plugins: [react()],
  css: {
    preprocessorOptions: {
      scss: {
        // 还可以在此添加其他 SCSS 选项，例如 additionalData 等
      }
    }
  },
  resolve: {
    alias: {
      '@': resolve('./src'),
      '@modules':  resolve('./modules')
    },
  },
  server: {
    proxy: {
      '/mock-api': {
        target: 'http://localhost:9999',
        changeOrigin: true,
        secure: false,
        rewrite: (path) => path.replace(/^\/mock-api/, ''),
      },
    },
  },
})
